﻿using System;
using AnjLab.SyncIT.Core.Api;
using AnjLab.SyncIT.Core.Data.DotProject;
using NUnit.Framework;

namespace AnjLab.SyncIT.Core.Tests.Data.DotProject
{
    [TestFixture]
    public class TestDotProjectOnline
    {
        [Test]
        public void TestLive()
        {
            Assert.Ignore("Provide dotProject source settings");

            var source = new Source
                                {
                                    ProjectBase = "dotProjectURL",
                                    ProviderKey = "dotProject",
                                    UserName = "user",
                                    OutlookCategory = "Работа",
                                    OutlookPrefix = "dp"
                                };

            source.SetPassword("pwd");

            ISourceTaskDao dao = source.GetTaskDao();
            
            string[] tasks = dao.GetChangedTasks();

            foreach (string id in tasks)
            {
                Console.WriteLine(id);
            }

            tasks = dao.GetChangedTasks();

            foreach (string id in tasks)
            {
                Console.WriteLine(id);
            }

            var task = (Task) dao.Get("351");

            task.Progress = 90;
            task.Milestone = false;

            ((DotProjectTaskDao) dao).Parser.SendTaskDataBack(task);
        }
    }
}
